package com.example.lzy.listviewsample.AutoCompleteTextView;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.MultiAutoCompleteTextView;

import com.example.lzy.listviewsample.R;

public class AutoCompleteTextViewActivity extends AppCompatActivity {

    private AutoCompleteTextView autoCompleteTextView = null;
    private MultiAutoCompleteTextView multiAutoCompleteTextView = null;
    private String[] strings = {"test","abc","afasf","ok","aadd"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.autocomplete_textview_layout);

        autoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.auto_actv);
        multiAutoCompleteTextView = (MultiAutoCompleteTextView) findViewById(R.id.mauto_mactv);

        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,strings);

        autoCompleteTextView.setAdapter(adapter);
        multiAutoCompleteTextView.setAdapter(adapter);

        multiAutoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    }
}
